package com.example.system.controller;

import com.example.system.controller.dto.SysUserDTO;
import com.example.system.model.ApiResponse;
import com.example.system.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * author: adnaan
 * create: 2023-11-01 20:15
 * Description:
 */

@RestController
@RequestMapping("/system")
public class SysUserController {

    @Autowired
    private SysUserService sysUserService;

    @PostMapping("/login")
    public ApiResponse login(@RequestBody SysUserDTO sysUserDTO) {
        String username = sysUserDTO.getUsername();
        String password = sysUserDTO.getPassword();
        return sysUserService.login(username, password);
    }

    @GetMapping("/UserDetail")
    public ApiResponse UserDetail(@RequestParam String username){
        return sysUserService.userDetail(username);
    }
}
